package com.msb.mall.search.controller;


import com.msb.mall.search.entity.vo.SearchParam;
import com.msb.mall.search.entity.vo.SearchResult;
import com.msb.mall.search.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class SearchController {

    @Autowired
    SearchService searchService;
    @GetMapping(value={"/list.html","/","/search.html"})
    public String  listPage(SearchParam searchParam, Model model){
        //根据对应的service传递过来的相关信息去es中检索
        SearchResult search = searchService.search(searchParam);
        model.addAttribute("search",search);
        return "index";
    }
}
